import InterbankTransferData from './data';
import { POST, } from '../../../commons/utils/request';

export default class PayeeUserListBusiness {
  // 汇出 提交接口参数构造
  static requestDataForSubmit() {
    let result = {
      "agentBankAddress": "",
      "agentBankCountryCode": "",
      "agentBankName": "",
      "agentBankSwiftNo": "",
      "ifHasAgent": 0,
      "mobile": "",
      "receiverAddress": "",
      "receiverBankAddress": "",
      "receiverBankCard": "",
      "receiverBankCountryCode": "",
      "receiverBankName": "",
      "receiverBankSwiftNo": "",
      "receiverCountryCode": "",
      "receiverName": "",
      "receiverType": 0
    };

    return result
  }
  static doCommit(payeeInfo,success, fail) {
    
/**
 * 
 *       "agentBankAddress": "",
      "agentBankCountryCode": "",
      "agentBankName": "",
      "agentBankSwiftNo": "",
      "ifHasAgent": 0,
      "mobile": "",
      "receiverAddress": "",
      "receiverBankAddress": "",
      "receiverBankCard": "",
      "receiverBankCountryCode": "",
      "receiverBankName": "",
      "receiverBankSwiftNo": "",
      "receiverCountryCode": "",
      "receiverName": "",
      "receiverType": 0
 */
    POST('http://120.48.109.211:8088//deal/addReceiverInfo', JSON.stringify({
      ...payeeInfo
    })).then(resp => {
      if (resp && resp.code == 0) {
        success && success(resp);
      } else {
        fail && fail(resp);
      }
    });
  }

  static fetchPayeeList(params,success, fail) {
    const {keyWord,pageSize,pageNum} = params
    POST('http://120.48.109.211:8088/deal/receiverList', JSON.stringify({
      keyWord,
      pageNum: 1,
      pageSize: 100
    })).then(resp => {
      if (resp && resp.data) {
        success && success(resp.data);
      } else {
        fail && fail(resp);
      }
    });
  }
}
